<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>4.佳丽列表</title>
    <script src="./vue.global.js"></script>
</head>
<body>
<div id="vueApp">

</div>
<script type="application/javascript">
    Vue.createApp({
        data() {
            return {
                inputValue: '',
                list: ['大脚', '刘英', '晓红']
            }
        },
        methods : {
            handleAddItem() {
                this.list.push(this.inputValue);
                this.inputValue = '';
            }
        },
        template: `
          <div>
          <input v-model="inputValue" />
          <button v-on:click="handleAddItem">增加佳丽</button>
          <ul>
            <li v-for="(item, index) of list">[{{index + 1}}]{{item}}</li>
          </ul>
          </div>

        `
    }).mount("#vueApp");
</script>
</body>
</html>